package de.herberlin.webapp.image;

import java.io.Serializable;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;

@Entity
public class GalleryItem implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue
	private Integer id = null;

	@Lob
	@Basic(fetch = FetchType.LAZY)
	@Column(columnDefinition="mediumblob")
	private byte[] data = null;

	private String name = null;

	
	@JoinColumn(name="id", table="Page")
	private String pageId = null;

	private int position = 0;

	@Enumerated(value=EnumType.STRING)
	private ItemType type = null;

	public GalleryItem() {
	}

	public byte[] getData() {
		return data;
	}

	public void setData(byte[] data) {
		this.data = data;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public ItemType getType() {
		return type;
	}

	public void setType(ItemType type) {
		this.type = type;
	}

	public String getPageId() {
		return pageId;
	}

	public void setPageId(String pageId) {
		this.pageId = pageId;
	}

	public int getPosition() {
		return position;
	}

	public void setPosition(int position) {
		this.position = position;
	}

	public String toString() {
		return "GalleryItem(" + id + "), name=" + name + ", position="
				+ position;
	}
}
